home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume12 / cnews / part03 < prev    next >
Encoding:
Internet Message Format  |  1987-10-19  |  57.4 KB

  1. Subject:  v12i028:  C News alpha release, Part03/14
  2. Newsgroups: comp.sources.unix
  3. Sender: sources
  4. Approved: rs@uunet.UU.NET
  5.  
  6. Submitted-by: utzoo!henry (Henry Spencer)
  7. Posting-number: Volume 12, Issue 28
  8. Archive-name: cnews/part03
  9.  
  10. #! /bin/sh
  11. # This is a shell archive.  Remove anything before this line, then unpack
  12. # it by saving it into a file and typing "sh file".  To overwrite existing
  13. # files, type "sh file -c".  You can also feed this as standard input via
  14. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  15. # will see the following message at the end:
  16. #        "End of archive 3 (of 14)."
  17. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  18. if test -f 'batch/batchprep' -a "${1}" != "-c" ; then 
  19.   echo shar: Will not clobber existing file \"'batch/batchprep'\"
  20. else
  21. echo shar: Extracting \"'batch/batchprep'\" \(1163 characters\)
  22. sed "s/^X//" >'batch/batchprep' <<'END_OF_FILE'
  23. X# Prepare some batches of size $1 in files named togo.* .  We prepare a
  24. X# total of 5 to stay well within awk's limits on file descriptors.
  25. X#
  26. X# Buglet:  does not count the "#! rnews nnnnn" headers in sizes.
  27. X#
  28. X# If the togo file does not contain file sizes, we make an arbitrary guess
  29. X# at an average size.
  30. X
  31. Xcase $#
  32. Xin
  33. X    0)
  34. X    echo 'Usage: batchprep size' >&2
  35. X    exit 2
  36. X    ;;
  37. Xesac
  38. X
  39. XNEWSCTL=${NEWSCTL-/usr/lib/news}
  40. XNEWSUMASK=${NEWSUMASK-002}
  41. Xumask $NEWSUMASK
  42. X
  43. X# Locking.
  44. X(
  45. X    cd $NEWSCTL
  46. X    echo $$ >LOCKTM$$
  47. X    until ln LOCKTM$$ LOCK >/dev/null 2>/dev/null
  48. X    do
  49. X        sleep 15
  50. X    done
  51. X    rm LOCKTM$$
  52. X)
  53. Xtrap "rm -f $NEWSCTL/LOCK ; exit" 0 1 2 3 15
  54. X
  55. Xrm -f togo.overflow
  56. X
  57. Xawk 'BEGIN { total = 0; nfile = 0 ; nbatch = 1 ; batch = "togo." nbatch }
  58. X    {
  59. X        if (NF == 1)
  60. X            size = 3000    # Arbitrary guess.
  61. X        else
  62. X            size = $2
  63. X        if (nfile > 0 && total + size > '$1') {
  64. X            # Go to next batch.
  65. X            nbatch++
  66. X            if (nbatch <= 5) {
  67. X                batch = "togo." nbatch
  68. X                nfile = 0
  69. X            } else {
  70. X                batch = "togo.overflow"
  71. X                nfile = -999999    # rest all goes into overflow
  72. X            }
  73. X            total = 0
  74. X        }
  75. X        nfile++
  76. X        total += size
  77. X        print >batch
  78. X    }' togo
  79. X
  80. Xif test -r togo.overflow
  81. Xthen
  82. X    mv togo.overflow togo
  83. Xelse
  84. X    >togo
  85. Xfi
  86. END_OF_FILE
  87. if test 1163 -ne `wc -c <'batch/batchprep'`; then
  88.     echo shar: \"'batch/batchprep'\" unpacked with wrong size!
  89. fi
  90. # end of 'batch/batchprep'
  91. fi
  92. if test -f 'batch/testmakefile' -a "${1}" != "-c" ; then 
  93.   echo shar: Will not clobber existing file \"'batch/testmakefile'\"
  94. else
  95. echo shar: Extracting \"'batch/testmakefile'\" \(768 characters\)
  96. sed "s/^X//" >'batch/testmakefile' <<'END_OF_FILE'
  97. XFILES = 0 1 2 3 4 5 6 7 8 9 10 11 12 13
  98. X
  99. Xr:    test.togo test.togo.3 $(FILES) chmods
  100. X    rm -f togo*
  101. X    cp test.togo togo
  102. X    cp test.togo.3 togo.3
  103. X    rm -f output
  104. X    NEWSARTS=`pwd` $NEWSBIN/batch/sendbatches test
  105. X    for f in togo* ; do echo === $$f === ; cat $$f ; done >>output
  106. X    @echo 'No news is good news...'
  107. X    cmp output goodoutput && rm -f togo* output $(FILES)
  108. X
  109. Xtry:    test.togo test.togo.3 $(FILES) chmods
  110. X    rm -f togo*
  111. X    cp test.togo togo
  112. X    cp test.togo.3 togo.3
  113. X    rm -f output
  114. X    NEWSARTS=`pwd` sh -x $NEWSBIN/batch/sendbatches test
  115. X    for f in togo* ; do echo === $$f === ; cat $$f ; done >>output
  116. X    cmp output goodoutput && rm -f togo* output $(FILES)
  117. X
  118. X$(FILES):
  119. X    for f in $(FILES) ; do echo $$f >$$f; done
  120. X
  121. Xclean:
  122. X    rm -f togo* output $(FILES)
  123. X
  124. Xchmods:
  125. X    chmod +x batch* queue* roomfor
  126. END_OF_FILE
  127. if test 768 -ne `wc -c <'batch/testmakefile'`; then
  128.     echo shar: \"'batch/testmakefile'\" unpacked with wrong size!
  129. fi
  130. # end of 'batch/testmakefile'
  131. fi
  132. if test -f 'expire/lowest.c' -a "${1}" != "-c" ; then 
  133.   echo shar: Will not clobber existing file \"'expire/lowest.c'\"
  134. else
  135. echo shar: Extracting \"'expire/lowest.c'\" \(896 characters\)
  136. sed "s/^X//" >'expire/lowest.c' <<'END_OF_FILE'
  137. X/*
  138. X * lowest - print the number of the lowest article in a directory
  139. X */
  140. X
  141. X#include <stdio.h>
  142. X#include <sys/types.h>
  143. X#include <dirent.h>
  144. X
  145. X#define    HUGE    999999999L    /* Bigger than any valid article number. */
  146. X
  147. Xchar *progname;
  148. X
  149. X/*
  150. X - main - parse arguments and handle options
  151. X */
  152. Xmain(argc, argv)
  153. Xint argc;
  154. Xchar *argv[];
  155. X{
  156. X    DIR *d;
  157. X    register struct dirent *dp;
  158. X    long lowest = HUGE;
  159. X    long this;
  160. X    extern long atol();
  161. X
  162. X    progname = argv[0];
  163. X
  164. X    if (argc != 2) {
  165. X        fprintf(stderr, "usage: %s directory\n", progname);
  166. X        exit(2);
  167. X    }
  168. X
  169. X    d = opendir(argv[1]);
  170. X    if (d == NULL) {
  171. X        fprintf(stderr, "%s: can't read directory %s\n", progname,
  172. X                                argv[1]);
  173. X        exit(1);
  174. X    }
  175. X    while ((dp = readdir(d)) != NULL) {
  176. X        if (strspn(dp->d_name, "0123456789") == strlen(dp->d_name)) {
  177. X            this = atol(dp->d_name);
  178. X            if (this < lowest)
  179. X                lowest = this;
  180. X        }
  181. X    }
  182. X    closedir(d);
  183. X
  184. X    if (lowest != HUGE)
  185. X        printf("%ld\n", lowest);
  186. X}
  187. END_OF_FILE
  188. if test 896 -ne `wc -c <'expire/lowest.c'`; then
  189.     echo shar: \"'expire/lowest.c'\" unpacked with wrong size!
  190. fi
  191. # end of 'expire/lowest.c'
  192. fi
  193. if test -f 'expire/mkdbm.c' -a "${1}" != "-c" ; then 
  194.   echo shar: Will not clobber existing file \"'expire/mkdbm.c'\"
  195. else
  196. echo shar: Extracting \"'expire/mkdbm.c'\" \(1046 characters\)
  197. sed "s/^X//" >'expire/mkdbm.c' <<'END_OF_FILE'
  198. X/*
  199. X * mkdbm - rebuild dbm file for a history file
  200. X *
  201. X * History file on standard input; the dbm database is generated as
  202. X * it.dir and it.pag.
  203. X */
  204. X#include <stdio.h>
  205. X#include <string.h>
  206. X#include <ctype.h>
  207. X
  208. X
  209. Xchar *progname = "mkdbm";
  210. Xtypedef struct { char *dptr; int dsize; } datum;
  211. X
  212. Xmain()
  213. X{
  214. X    char buf[BUFSIZ];
  215. X    register char *scan;
  216. X    long place;
  217. X    datum lhs;
  218. X    datum rhs;
  219. X    register int ret;
  220. X
  221. X    close(creat("it.dir", 0666));
  222. X    close(creat("it.pag", 0666));
  223. X    dbminit("it");
  224. X
  225. X    for (;;) {
  226. X        place = ftell(stdin);
  227. X        if (fgets(buf, BUFSIZ, stdin) == NULL)
  228. X            break;
  229. X
  230. X        scan = strchr(buf, '\t');
  231. X        if (scan == NULL || buf[strlen(buf)-1] != '\n') {
  232. X            fprintf(stderr, "bad format: %s", buf);
  233. X            exit(1);
  234. X        }
  235. X        *scan = '\0';
  236. X
  237. X        for (scan = buf; *scan != '\0'; scan++)
  238. X            if (isascii(*scan) && isupper(*scan))
  239. X                *scan = tolower(*scan);
  240. X
  241. X        lhs.dptr = buf;
  242. X        lhs.dsize = strlen(buf) + 1;
  243. X        rhs.dptr = (char *)&place;
  244. X        rhs.dsize = sizeof place;
  245. X        ret = store(lhs, rhs);
  246. X        if (ret < 0)
  247. X            fprintf(stderr, "dbm failure '%s' @ %ld\n", buf, place);
  248. X    }
  249. X    exit(0);
  250. X}
  251. END_OF_FILE
  252. if test 1046 -ne `wc -c <'expire/mkdbm.c'`; then
  253.     echo shar: \"'expire/mkdbm.c'\" unpacked with wrong size!
  254. fi
  255. # end of 'expire/mkdbm.c'
  256. fi
  257. if test -f 'expire/upact' -a "${1}" != "-c" ; then 
  258.   echo shar: Will not clobber existing file \"'expire/upact'\"
  259. else
  260. echo shar: Extracting \"'expire/upact'\" \(1194 characters\)
  261. sed "s/^X//" >'expire/upact' <<'END_OF_FILE'
  262. X#! /bin/sh
  263. X# Update 3rd field (minimum art. #) of a 4-field active file.
  264. X
  265. XNEWSCTL=${NEWSCTL-/usr/lib/news}
  266. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}
  267. XNEWSARTS=${NEWSARTS-/usr/spool/news}
  268. XPATH=$NEWSBIN/expire:/bin:/usr/bin ; export PATH
  269. XNEWSUMASK=${NEWSUMASK-002}
  270. Xumask NEWSUMASK
  271. X
  272. Xcd $NEWSCTL || { echo "$0: can't cd to $NEWSCTL" >&2; exit 1; }
  273. X
  274. X# check active file format
  275. Xset ""`sed 1q active`
  276. Xcase $# in
  277. X4)    ;;
  278. X*)
  279. X    echo "$0: active file has other than 4 fields" >&2
  280. X    exit 1
  281. X    ;;
  282. Xesac
  283. X
  284. X# lock news system
  285. Xuntil ln active LOCK >/dev/null 2>/dev/null
  286. Xdo
  287. X    sleep 30
  288. Xdone
  289. Xtrap "rm -f LOCK" 0 1 2 15    # unlock on exit or death
  290. X
  291. Xwhile read group max min fourth
  292. Xdo
  293. X    dir=`echo $group | tr . / `    # map ng name to directory name
  294. X    min=$max            # default
  295. X    if test -d $NEWSARTS/$dir
  296. X    then
  297. X        min=`lowest $NEWSARTS/$dir`
  298. X    fi
  299. X    case "$min" in        # no files, so
  300. X    "")    min=$max ;;    # use maximum
  301. X    esac
  302. X    case "$min" in
  303. X    [0-9][0-9][0-9][0-9][0-9])    ;;    # cool format
  304. X    *)
  305. X        # touch up the article number format: make 5 digits long
  306. X        min=`expr 00000$min : '.*\(.....\)$'`
  307. X        ;;
  308. X    esac
  309. X
  310. X    echo $group $max $min $fourth
  311. Xdone <active >active.new
  312. X
  313. X# replace active, carefully
  314. Xrm -f active.old
  315. Xln active active.old
  316. Xmv active.new active
  317. X
  318. Xexit 0
  319. END_OF_FILE
  320. if test 1194 -ne `wc -c <'expire/upact'`; then
  321.     echo shar: \"'expire/upact'\" unpacked with wrong size!
  322. fi
  323. # end of 'expire/upact'
  324. fi
  325. if test -f 'input/Makefile' -a "${1}" != "-c" ; then 
  326.   echo shar: Will not clobber existing file \"'input/Makefile'\"
  327. else
  328. echo shar: Extracting \"'input/Makefile'\" \(876 characters\)
  329. sed "s/^X//" >'input/Makefile' <<'END_OF_FILE'
  330. X# If you don't have a dirent.h header file, add -I. to CFLAGS and see README.
  331. XDEFINES =
  332. XCFLAGS = -O $(DEFINES) -I../include
  333. XLINTFLAGS = $(DEFINES) -Dvoid=int
  334. XLDFLAGS = -i
  335. XOBJS=newsspool.o
  336. XLIBS= ../libcnews/libcnews.a ../libc/*.a
  337. XTHEM = newsspool newsrun newsrunning
  338. XNEWSBIN = /usr/lib/newsbin
  339. XNEWSCTL = /usr/lib/news
  340. X
  341. Xnewsspool: $(OBJS)
  342. X    $(CC) $(LDFLAGS) $(OBJS) $(LIBS) -o $@
  343. X
  344. Xinstall:    $(THEM)
  345. X    chmod +x $(THEM) rnews
  346. X    cp $(THEM) $(NEWSBIN)/input
  347. X    chmod u+s $(NEWSBIN)/input/newsspool
  348. X    mkdir $(NEWSCTL)/incoming $(NEWSCTL)/incoming/bad
  349. X    cp rnews /bin/rnews
  350. X    cp rnews /bin/cunbatch
  351. X
  352. Xclean:
  353. X    rm -f *.o newsspool
  354. X    rm -rf incoming
  355. X
  356. Xsetup:
  357. X    mkdir incoming incoming/bad
  358. X
  359. Xtry1:    goo newsspool setup
  360. X    NEWSCTL=`pwd` newsspool <goo
  361. X
  362. Xtry2:    try1
  363. X    NEWSCTL=`pwd` sh -x newsrunning off
  364. X    NEWSCTL=`pwd` sh -x newsrun
  365. X
  366. Xtry:    try2
  367. X    NEWSCTL=`pwd` sh -x newsrunning on
  368. X    NEWSCTL=`pwd` sh -x newsrun
  369. END_OF_FILE
  370. if test 876 -ne `wc -c <'input/Makefile'`; then
  371.     echo shar: \"'input/Makefile'\" unpacked with wrong size!
  372. fi
  373. # end of 'input/Makefile'
  374. fi
  375. if test -f 'input/newsrun' -a "${1}" != "-c" ; then 
  376.   echo shar: Will not clobber existing file \"'input/newsrun'\"
  377. else
  378. echo shar: Extracting \"'input/newsrun'\" \(1138 characters\)
  379. sed "s/^X//" >'input/newsrun' <<'END_OF_FILE'
  380. X#! /bin/sh
  381. X# Process spooled news.
  382. X
  383. XNEWSCTL=${NEWSCTL-/usr/lib/news}
  384. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}
  385. XNEWSARTS=${NEWSARTS-/usr/spool/news}
  386. XPATH=$NEWSBIN/input:/bin:/usr/bin ; export PATH
  387. XNEWSUMASK=${NEWSUMASK-002}
  388. Xumask NEWSUMASK
  389. X
  390. Xcd $NEWSCTL/incoming
  391. X
  392. X# First, is it worth trying at all?
  393. Xif test -r stop
  394. Xthen
  395. X    exit 0
  396. Xfi
  397. X
  398. X# Lock against others running.
  399. Xecho $$ >L.$$
  400. Xif ln L.$$ RLOCK >/dev/null 2>&1
  401. Xthen
  402. X    trap "rm -f L.$$ RLOCK" 0 1 2 15
  403. Xelse
  404. X    rm -f L.$$
  405. X    exit 0
  406. Xfi
  407. X
  408. Xwhile true
  409. Xdo
  410. X    # Find some work.
  411. X    them=`ls | egrep '^[0-9]+$' | sort | sed 50q`
  412. X    if test "$them" = ""
  413. X    then
  414. X        break
  415. X    fi
  416. X
  417. X    # Do it.
  418. X    for f in $them
  419. X    do
  420. X        # Check for request to stop.
  421. X        if test -r stop
  422. X        then
  423. X            exit 0
  424. X        fi
  425. X
  426. X        # Decompress if necessary.
  427. X        text=np.$$
  428. X        if compress -d <$f >$text 2>/dev/null
  429. X        then
  430. X            : ok
  431. X        else
  432. X            rm -f $text
  433. X            text=$f
  434. X        fi
  435. X
  436. X        # Do it.
  437. X        $NEWSBIN/relay/realrnews <$text >/tmp/npm$$ 2>&1
  438. X
  439. X        # And handle the consequences.
  440. X        if test -s /tmp/npm$$
  441. X        then
  442. X            bad=bad/$f
  443. X            cp $text $bad
  444. X            ( echo rnews $bad failed ; cat /tmp/npm$$ ) | mail news
  445. X        fi
  446. X
  447. X        rm -f /tmp/npm$$ $text $f
  448. X    done
  449. Xdone
  450. X
  451. Xfind bad -ctime +7 -exec rm -f {} \;
  452. X
  453. Xexit 0
  454. END_OF_FILE
  455. if test 1138 -ne `wc -c <'input/newsrun'`; then
  456.     echo shar: \"'input/newsrun'\" unpacked with wrong size!
  457. fi
  458. # end of 'input/newsrun'
  459. fi
  460. if test -f 'lib.proto/control/newgroup' -a "${1}" != "-c" ; then 
  461.   echo shar: Will not clobber existing file \"'lib.proto/control/newgroup'\"
  462. else
  463. echo shar: Extracting \"'lib.proto/control/newgroup'\" \(1152 characters\)
  464. sed "s/^X//" >'lib.proto/control/newgroup' <<'END_OF_FILE'
  465. X#! /bin/sh
  466. X# newgroup group - create group (4-field version: B-2.10.3 and later compatible)
  467. X#    subject to our sys file group pattern
  468. X# B 2.11 requires an Approved: header; someday.
  469. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  470. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  471. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  472. XPATH=/bin:/usr/bin:/usr/ucb:$NEWSCTL:$NEWSBIN; export PATH    # must find mkpdir
  473. XF=/tmp/nc$$
  474. Xadmin=usenet
  475. X
  476. Xcat >$F
  477. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  478. Xcase "$SENDER" in
  479. X"")
  480. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  481. X    ;;
  482. Xesac
  483. X
  484. Xif grep -s "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active; then    # group exists
  485. X    : do nothing
  486. Xelif gngp -a `
  487. X    egrep "^(\`hostname\`|ME):" $NEWSCTL/sys | awk -F: '{print $2; exit}'
  488. X    ` >/dev/null <<!
  489. X$1
  490. X!
  491. Xthen            # no group in active, but sys file likes it: make it
  492. X    case "$2" in
  493. X    moderated)    flag=m ;;
  494. X    *)    flag=y ;;
  495. X    esac
  496. X    echo "$1 00000 00000 $flag" >>$NEWSCTL/active
  497. X    # TODO: is it worth making the directory now? maybe, rn bitches otherwise
  498. X    mkpdir $NEWSARTS/`echo $1 | sed 's/\./\//g' `
  499. X    echo "newsgroup $1 was created by $SENDER." | mail $admin
  500. Xfi
  501. X
  502. Xrm -f $F*
  503. END_OF_FILE
  504. if test 1152 -ne `wc -c <'lib.proto/control/newgroup'`; then
  505.     echo shar: \"'lib.proto/control/newgroup'\" unpacked with wrong size!
  506. fi
  507. # end of 'lib.proto/control/newgroup'
  508. fi
  509. if test -f 'lib.proto/control/newgroup.2' -a "${1}" != "-c" ; then 
  510.   echo shar: Will not clobber existing file \"'lib.proto/control/newgroup.2'\"
  511. else
  512. echo shar: Extracting \"'lib.proto/control/newgroup.2'\" \(771 characters\)
  513. sed "s/^X//" >'lib.proto/control/newgroup.2' <<'END_OF_FILE'
  514. X#! /bin/sh
  515. X# newgroup group - create group (2-field version: pre-B-2.10.2 compatible)
  516. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  517. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  518. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  519. XPATH=/bin:/usr/bin:/usr/ucb:$NEWSCTL:$NEWSBIN; export PATH    # must find mkpdir
  520. XF=/tmp/nc$$
  521. Xadmin=usenet
  522. X
  523. Xcat >$F
  524. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  525. Xcase "$SENDER" in
  526. X"")
  527. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  528. X    ;;
  529. Xesac
  530. X
  531. Xif grep -s "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active; then    # group exists
  532. X    : do nothing
  533. Xelse                            # no group, make it
  534. X    echo "$1 00000" >>$NEWSCTL/active
  535. X    mkpdir $NEWSARTS/`echo $1 | sed 's/\./\//g' `
  536. X    echo "newsgroup $1 was created by $SENDER." | mail $admin
  537. Xfi
  538. X
  539. Xrm -f $F*
  540. END_OF_FILE
  541. if test 771 -ne `wc -c <'lib.proto/control/newgroup.2'`; then
  542.     echo shar: \"'lib.proto/control/newgroup.2'\" unpacked with wrong size!
  543. fi
  544. # end of 'lib.proto/control/newgroup.2'
  545. fi
  546. if test -f 'lib.proto/control/newgroup.3' -a "${1}" != "-c" ; then 
  547.   echo shar: Will not clobber existing file \"'lib.proto/control/newgroup.3'\"
  548. else
  549. echo shar: Extracting \"'lib.proto/control/newgroup.3'\" \(773 characters\)
  550. sed "s/^X//" >'lib.proto/control/newgroup.3' <<'END_OF_FILE'
  551. X#! /bin/sh
  552. X# newgroup group - create group (3-field version: B-2.10.2 compatible)
  553. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  554. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  555. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  556. XPATH=/bin:/usr/bin:/usr/ucb:$NEWSCTL:$NEWSBIN; export PATH    # must find mkpdir
  557. XF=/tmp/nc$$
  558. Xadmin=usenet
  559. X
  560. Xcat >$F
  561. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  562. Xcase "$SENDER" in
  563. X"")
  564. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  565. X    ;;
  566. Xesac
  567. X
  568. Xif grep -s "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active; then    # group exists
  569. X    : do nothing
  570. Xelse                            # no group, make it
  571. X    echo "$1 00000 00000" >>$NEWSCTL/active
  572. X    mkpdir $NEWSARTS/`echo $1 | sed 's/\./\//g' `
  573. X    echo "newsgroup $1 was created by $SENDER." | mail $admin
  574. Xfi
  575. X
  576. Xrm -f $F*
  577. END_OF_FILE
  578. if test 773 -ne `wc -c <'lib.proto/control/newgroup.3'`; then
  579.     echo shar: \"'lib.proto/control/newgroup.3'\" unpacked with wrong size!
  580. fi
  581. # end of 'lib.proto/control/newgroup.3'
  582. fi
  583. if test -f 'lib.proto/control/newgroup.4' -a "${1}" != "-c" ; then 
  584.   echo shar: Will not clobber existing file \"'lib.proto/control/newgroup.4'\"
  585. else
  586. echo shar: Extracting \"'lib.proto/control/newgroup.4'\" \(1152 characters\)
  587. sed "s/^X//" >'lib.proto/control/newgroup.4' <<'END_OF_FILE'
  588. X#! /bin/sh
  589. X# newgroup group - create group (4-field version: B-2.10.3 and later compatible)
  590. X#    subject to our sys file group pattern
  591. X# B 2.11 requires an Approved: header; someday.
  592. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  593. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  594. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  595. XPATH=/bin:/usr/bin:/usr/ucb:$NEWSCTL:$NEWSBIN; export PATH    # must find mkpdir
  596. XF=/tmp/nc$$
  597. Xadmin=usenet
  598. X
  599. Xcat >$F
  600. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  601. Xcase "$SENDER" in
  602. X"")
  603. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  604. X    ;;
  605. Xesac
  606. X
  607. Xif grep -s "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active; then    # group exists
  608. X    : do nothing
  609. Xelif gngp -a `
  610. X    egrep "^(\`hostname\`|ME):" $NEWSCTL/sys | awk -F: '{print $2; exit}'
  611. X    ` >/dev/null <<!
  612. X$1
  613. X!
  614. Xthen            # no group in active, but sys file likes it: make it
  615. X    case "$2" in
  616. X    moderated)    flag=m ;;
  617. X    *)    flag=y ;;
  618. X    esac
  619. X    echo "$1 00000 00000 $flag" >>$NEWSCTL/active
  620. X    # TODO: is it worth making the directory now? maybe, rn bitches otherwise
  621. X    mkpdir $NEWSARTS/`echo $1 | sed 's/\./\//g' `
  622. X    echo "newsgroup $1 was created by $SENDER." | mail $admin
  623. Xfi
  624. X
  625. Xrm -f $F*
  626. END_OF_FILE
  627. if test 1152 -ne `wc -c <'lib.proto/control/newgroup.4'`; then
  628.     echo shar: \"'lib.proto/control/newgroup.4'\" unpacked with wrong size!
  629. fi
  630. # end of 'lib.proto/control/newgroup.4'
  631. fi
  632. if test -f 'lib.proto/control/rmgroup.auto' -a "${1}" != "-c" ; then 
  633.   echo shar: Will not clobber existing file \"'lib.proto/control/rmgroup.auto'\"
  634. else
  635. echo shar: Extracting \"'lib.proto/control/rmgroup.auto'\" \(995 characters\)
  636. sed "s/^X//" >'lib.proto/control/rmgroup.auto' <<'END_OF_FILE'
  637. X#! /bin/sh
  638. X# rmgroup group - snuff group. active file is locked at entry
  639. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  640. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  641. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  642. XF=/tmp/nc$$
  643. Xadmin=usenet
  644. X
  645. Xcat >$F
  646. X
  647. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  648. Xcase "$SENDER" in
  649. X"")
  650. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  651. X    ;;
  652. Xesac
  653. X
  654. X# remove active entry
  655. Xsed "/^`echo $1 | sed 's/\./\\\\./g'` /d" $NEWSCTL/active >$F.act
  656. Xcp $NEWSCTL/active $NEWSCTL/active.old
  657. Xcp $F.act $NEWSCTL/active
  658. X
  659. X# rm -rf $NEWSARTS/`echo $1 | sed 's;\.;/;g'`    # remove the directory
  660. Xdir=$NEWSARTS/`echo $1 | sed 's;\.;/;g'`    # name the directory
  661. Xexport dir                # for sub-shell below
  662. X(
  663. X    cd /tmp                # in case "cd $dir" fails but shell continues
  664. X    cd $dir                # go there
  665. X    rm -f *
  666. X    cd ..
  667. X    rmdir `basename "$dir" '' `    # remove the empty directory
  668. X)
  669. X
  670. X# tell the local usenet administrator the bad news
  671. Xecho "rmgrouped $1 cuz $SENDER said to" | mail $admin
  672. X
  673. Xrm -f $F*
  674. END_OF_FILE
  675. if test 995 -ne `wc -c <'lib.proto/control/rmgroup.auto'`; then
  676.     echo shar: \"'lib.proto/control/rmgroup.auto'\" unpacked with wrong size!
  677. fi
  678. # end of 'lib.proto/control/rmgroup.auto'
  679. fi
  680. if test -f 'lib.proto/sys' -a "${1}" != "-c" ; then 
  681.   echo shar: Will not clobber existing file \"'lib.proto/sys'\"
  682. else
  683. echo shar: Extracting \"'lib.proto/sys'\" \(1052 characters\)
  684. sed "s/^X//" >'lib.proto/sys' <<'END_OF_FILE'
  685. X# ourselves: accept almost everything we get from our feed (rather limited)
  686. Xutstat:comp,news,list,to,junk,control,sci.crypt,sci.math,misc.jobs,\
  687. X!comp.binaries,!comp.sys,comp.sys.sun,comp.sys.ibm,comp.sys.mac,\
  688. X!comp.lang.lisp,can,ont,tor,ut,!ut.stardate,utstat,\
  689. X!all.all.amiga,!all.all.atari,!all.all.xenix,!all.all.venix,\
  690. X!all.games,!all.all.games,!all.all.vms,!all.all.ada,!all.all.cpm,\
  691. X!all.all.kermit,!all.all.appletalk,!general/world,na,can,ont,tor,ut,utstat
  692. X# our news feed: send everything & locally-written articles go direct
  693. Xutgpu:all,!to,to.utgpu,!utstat:F:/usr/lib/news/batch/b.utcs/togo
  694. Xutgpu:all,!to,to.utgpu,!utstat:L:/usr/lib/news/sendnews utcs!rnews
  695. X# local groups go out to local sites faster
  696. Xutcsri:world,na,can,ont,tor,ut,to.utcsri:L:/usr/lib/news/sendnews utcsri!rnews
  697. X# eventually chew up mod.map for pathalias; for now mail so they aren't lost
  698. Xuucpmap:comp.mail.map/world,na,can,ont,tor,ut::/usr/lib/news/uucpmapmuncher
  699. X# various individuals get our hacknews by mail
  700. Xhacknewsers:utstat.hacknews/world,utstat::mail hacknewsers
  701. END_OF_FILE
  702. if test 1052 -ne `wc -c <'lib.proto/sys'`; then
  703.     echo shar: \"'lib.proto/sys'\" unpacked with wrong size!
  704. fi
  705. # end of 'lib.proto/sys'
  706. fi
  707. if test -f 'libc/getopt.c' -a "${1}" != "-c" ; then 
  708.   echo shar: Will not clobber existing file \"'libc/getopt.c'\"
  709. else
  710. echo shar: Extracting \"'libc/getopt.c'\" \(1073 characters\)
  711. sed "s/^X//" >'libc/getopt.c' <<'END_OF_FILE'
  712. X/*
  713. X * getopt - get option letter from argv
  714. X */
  715. X
  716. X#include <stdio.h>
  717. X
  718. Xchar    *optarg;    /* Global argument pointer. */
  719. Xint    optind = 0;    /* Global argv index. */
  720. X
  721. Xstatic char    *scan = NULL;    /* Private scan pointer. */
  722. X
  723. Xextern char    *index();
  724. X
  725. Xint
  726. Xgetopt(argc, argv, optstring)
  727. Xint argc;
  728. Xchar *argv[];
  729. Xchar *optstring;
  730. X{
  731. X    register char c;
  732. X    register char *place;
  733. X
  734. X    optarg = NULL;
  735. X
  736. X    if (scan == NULL || *scan == '\0') {
  737. X        if (optind == 0)
  738. X            optind++;
  739. X    
  740. X        if (optind >= argc || argv[optind][0] != '-' || argv[optind][1] == '\0')
  741. X            return(EOF);
  742. X        if (strcmp(argv[optind], "--")==0) {
  743. X            optind++;
  744. X            return(EOF);
  745. X        }
  746. X    
  747. X        scan = argv[optind]+1;
  748. X        optind++;
  749. X    }
  750. X
  751. X    c = *scan++;
  752. X    place = index(optstring, c);
  753. X
  754. X    if (place == NULL || c == ':') {
  755. X        fprintf(stderr, "%s: unknown option -%c\n", argv[0], c);
  756. X        return('?');
  757. X    }
  758. X
  759. X    place++;
  760. X    if (*place == ':') {
  761. X        if (*scan != '\0') {
  762. X            optarg = scan;
  763. X            scan = NULL;
  764. X        } else if (optind < argc) {
  765. X            optarg = argv[optind];
  766. X            optind++;
  767. X        } else {
  768. X            fprintf(stderr, "%s: -%c argument missing\n", argv[0], c);
  769. X            return('?');
  770. X        }
  771. X    }
  772. X
  773. X    return(c);
  774. X}
  775. END_OF_FILE
  776. if test 1073 -ne `wc -c <'libc/getopt.c'`; then
  777.     echo shar: \"'libc/getopt.c'\" unpacked with wrong size!
  778. fi
  779. # end of 'libc/getopt.c'
  780. fi
  781. if test -f 'libc/memcpy.fast/src/duff.long.c' -a "${1}" != "-c" ; then 
  782.   echo shar: Will not clobber existing file \"'libc/memcpy.fast/src/duff.long.c'\"
  783. else
  784. echo shar: Extracting \"'libc/memcpy.fast/src/duff.long.c'\" \(1064 characters\)
  785. sed "s/^X//" >'libc/memcpy.fast/src/duff.long.c' <<'END_OF_FILE'
  786. X#define LUMP long
  787. X
  788. Xmemcpy(to, from, count)    /* assumes unaligned LUMPs can be copied */
  789. Xregister char *from, *to;
  790. Xregister int count;
  791. X{
  792. X    /*
  793. X     * This code uses Duff's Device (tm Tom Duff)
  794. X     * to unroll the copying loop:
  795. X     * while (count-- > 0)
  796. X     *    *to++ = *from++;
  797. X     * Sorry the code is so ugly.
  798. X     */
  799. X    if (count > 0) {
  800. X        register int loops = count >> 3;    /* /8 */
  801. X        register LUMP *fromlump = (LUMP *)from, *tolump = (LUMP *)to;
  802. X
  803. X        count %= 8;        /* about to copy loops*8 bytes */
  804. X        while (loops-- > 0) {
  805. X            *tolump++ = *fromlump++;
  806. X            *tolump++ = *fromlump++;
  807. X        }
  808. X        from = (char *)fromlump;
  809. X        to = (char *)tolump;
  810. X    }
  811. X    /*
  812. X     * This code uses Duff's Device (tm Tom Duff)
  813. X     * to unroll the copying loop the last count%8 times:
  814. X     * while (count-- > 0)
  815. X     *    *to++ = *from++;
  816. X     * Sorry the code is so ugly.
  817. X     */
  818. X    if (count > 0) {
  819. X        switch (count&(8-1)) {    /* %8 */
  820. X        case 0:
  821. X#define COPYBYTE *to++ = *from++
  822. X                COPYBYTE;
  823. X            case 7:    COPYBYTE;
  824. X            case 6:    COPYBYTE;
  825. X            case 5:    COPYBYTE;
  826. X            case 4:    COPYBYTE;
  827. X            case 3:    COPYBYTE;
  828. X            case 2:    COPYBYTE;
  829. X            case 1:    COPYBYTE;
  830. X        }
  831. X    }
  832. X}
  833. END_OF_FILE
  834. if test 1064 -ne `wc -c <'libc/memcpy.fast/src/duff.long.c'`; then
  835.     echo shar: \"'libc/memcpy.fast/src/duff.long.c'\" unpacked with wrong size!
  836. fi
  837. # end of 'libc/memcpy.fast/src/duff.long.c'
  838. fi
  839. if test -f 'libc/memcpy.fast/times.ian' -a "${1}" != "-c" ; then 
  840.   echo shar: Will not clobber existing file \"'libc/memcpy.fast/times.ian'\"
  841. else
  842. echo shar: Extracting \"'libc/memcpy.fast/times.ian'\" \(1068 characters\)
  843. sed "s/^X//" >'libc/memcpy.fast/times.ian' <<'END_OF_FILE'
  844. XFrom: sq!ian
  845. XTo: utcs!geoff
  846. XCc: darwin!ian
  847. XSubject: bcopy timings
  848. XDate: 25 Feb 1986 0051-EST (Tuesday)
  849. X
  850. XScript started on Mon Feb 24 23:14:31 1986
  851. X% @ for f in obvious duff.byte duff.long duff.longs
  852. X> do echo $f
  853. X> cc bcopy.c $f.o
  854. X> time a.out
  855. X> time a.out
  856. X> time a.out
  857. X> done
  858. Xobvious
  859. XTime:      1:01.0 real        56.6 user         0.4 sys  
  860. XTime:      1:02.0 real        56.6 user         0.4 sys  
  861. XTime:        59.0 real        56.6 user         0.3 sys  
  862. Xduff.byte
  863. XTime:        19.0 real        17.1 user         0.3 sys  
  864. XTime:        17.0 real        17.1 user         0.3 sys  
  865. XTime:        18.0 real        17.1 user         0.3 sys  
  866. Xduff.long
  867. XTime:        13.0 real        11.6 user         0.4 sys  
  868. XTime:        12.0 real        11.5 user         0.3 sys  
  869. XTime:        12.0 real        11.5 user         0.3 sys  
  870. Xduff.longs
  871. XTime:        10.0 real         6.6 user         0.4 sys  
  872. XTime:         7.0 real         6.6 user         0.3 sys  
  873. XTime:         7.0 real         6.6 user         0.3 sys  
  874. X@ 
  875. Xscript done on Mon Feb 24 23:22:43 1986
  876. X
  877. XGreat stuff!
  878. END_OF_FILE
  879. if test 1068 -ne `wc -c <'libc/memcpy.fast/times.ian'`; then
  880.     echo shar: \"'libc/memcpy.fast/times.ian'\" unpacked with wrong size!
  881. fi
  882. # end of 'libc/memcpy.fast/times.ian'
  883. fi
  884. if test -f 'libc/putenv.c' -a "${1}" != "-c" ; then 
  885.   echo shar: Will not clobber existing file \"'libc/putenv.c'\"
  886. else
  887. echo shar: Extracting \"'libc/putenv.c'\" \(1131 characters\)
  888. sed "s/^X//" >'libc/putenv.c' <<'END_OF_FILE'
  889. X/*
  890. X * putenv - add a variable to the environment
  891. X */
  892. X
  893. X#include <stdio.h>
  894. X#include <sys/types.h>
  895. X
  896. X#define YES 1
  897. X#define NO 0
  898. X
  899. Xint
  900. Xputenv(var)            /* put var in the environment */
  901. Xchar *var;
  902. X{
  903. X    register char **envp, **newenv;
  904. X    register int oldenvcnt;
  905. X    extern char **environ;
  906. X    extern char *malloc();
  907. X
  908. X    /* count variables, look for var */
  909. X    for (envp = environ; *envp != 0; envp++) {
  910. X        register char *varp = var, *ep = *envp;
  911. X        register int namesame;
  912. X
  913. X        namesame = NO;
  914. X        for (; *varp == *ep && *varp != '\0'; ++ep, ++varp)
  915. X            if (*varp == '=')
  916. X                namesame = YES;
  917. X        if (*varp == *ep && *ep == '\0')
  918. X            return;            /* old & new var's are the same */
  919. X        if (namesame) {
  920. X            *envp = var;        /* replace var with new value */
  921. X            return;
  922. X        }
  923. X    }
  924. X    oldenvcnt = envp - environ;
  925. X
  926. X    /* allocate new environment with room for one more variable */
  927. X    newenv = (char **)malloc((oldenvcnt + 1 + 1)*sizeof(*envp));
  928. X    if (newenv == NULL)
  929. X        return NO;
  930. X
  931. X    /* copy old environment pointers, add var, switch environments */
  932. X    (void) memcpy(newenv, environ, oldenvcnt*sizeof(*envp));
  933. X    newenv[oldenvcnt] = var;
  934. X    newenv[oldenvcnt+1] = NULL;
  935. X    environ = newenv;
  936. X    return YES;
  937. X}
  938. END_OF_FILE
  939. if test 1131 -ne `wc -c <'libc/putenv.c'`; then
  940.     echo shar: \"'libc/putenv.c'\" unpacked with wrong size!
  941. fi
  942. # end of 'libc/putenv.c'
  943. fi
  944. if test -f 'libc/stdio.fast/_intro' -a "${1}" != "-c" ; then 
  945.   echo shar: Will not clobber existing file \"'libc/stdio.fast/_intro'\"
  946. else
  947. echo shar: Extracting \"'libc/stdio.fast/_intro'\" \(788 characters\)
  948. sed "s/^X//" >'libc/stdio.fast/_intro' <<'END_OF_FILE'
  949. XFrom: geoff (Geoff Collyer)
  950. XTo: research!dmr, sig
  951. XSubject: fast fgets, fread, fwrite, fputs
  952. XDate: 16 Dec 1985 0416-EST (Monday)
  953. X
  954. X[ Approximate wording ]  My new one is 15% faster than DMR's on
  955. X/usr/dict/words and 68% faster on /etc/passwd.  Uglix has some of the
  956. Xsame improvements.
  957. X
  958. XThese are faster versions of fputs, fread and fwrite. Unlike my fgets,
  959. Xthese are much faster than Dennis's and are still public-domain and
  960. Xplug-compatible. I haven't bothered measuring fputs, but I did three
  961. Xtiming trials using fread and fwrite to copy 195k from stdin to stdout
  962. Xeach time, using fread and fwrite buffers of 8 bytes, 512 bytes and
  963. X16,384 bytes.  Again on a 4.2 750, my fread/fwrite were respectively
  964. X1.67, 21.63 and 23.77 times faster than Dennis's.
  965. X
  966. XComments?
  967. X
  968. X[ much code omitted here ]
  969. END_OF_FILE
  970. if test 788 -ne `wc -c <'libc/stdio.fast/_intro'`; then
  971.     echo shar: \"'libc/stdio.fast/_intro'\" unpacked with wrong size!
  972. fi
  973. # end of 'libc/stdio.fast/_intro'
  974. fi
  975. if test -f 'libc/strings/strncmp.c' -a "${1}" != "-c" ; then 
  976.   echo shar: Will not clobber existing file \"'libc/strings/strncmp.c'\"
  977. else
  978. echo shar: Extracting \"'libc/strings/strncmp.c'\" \(755 characters\)
  979. sed "s/^X//" >'libc/strings/strncmp.c' <<'END_OF_FILE'
  980. X/*
  981. X * strncmp - compare at most n characters of string s1 to s2
  982. X */
  983. X
  984. Xint                /* <0 for <, 0 for ==, >0 for > */
  985. Xstrncmp(s1, s2, n)
  986. XCONST char *s1;
  987. XCONST char *s2;
  988. XSIZET n;
  989. X{
  990. X    register CONST char *scan1;
  991. X    register CONST char *scan2;
  992. X    register SIZET count;
  993. X
  994. X    scan1 = s1;
  995. X    scan2 = s2;
  996. X    count = n;
  997. X    while (--count >= 0 && *scan1 != '\0' && *scan1 == *scan2) {
  998. X        scan1++;
  999. X        scan2++;
  1000. X    }
  1001. X    if (count < 0)
  1002. X        return(0);
  1003. X
  1004. X    /*
  1005. X     * The following case analysis is necessary so that characters
  1006. X     * which look negative collate low against normal characters but
  1007. X     * high against the end-of-string NUL.
  1008. X     */
  1009. X    if (*scan1 == '\0' && *scan2 == '\0')
  1010. X        return(0);
  1011. X    else if (*scan1 == '\0')
  1012. X        return(-1);
  1013. X    else if (*scan2 == '\0')
  1014. X        return(1);
  1015. X    else
  1016. X        return(*scan1 - *scan2);
  1017. X}
  1018. END_OF_FILE
  1019. if test 755 -ne `wc -c <'libc/strings/strncmp.c'`; then
  1020.     echo shar: \"'libc/strings/strncmp.c'\" unpacked with wrong size!
  1021. fi
  1022. # end of 'libc/strings/strncmp.c'
  1023. fi
  1024. if test -f 'libc/strings/strtok.c' -a "${1}" != "-c" ; then 
  1025.   echo shar: Will not clobber existing file \"'libc/strings/strtok.c'\"
  1026. else
  1027. echo shar: Extracting \"'libc/strings/strtok.c'\" \(1103 characters\)
  1028. sed "s/^X//" >'libc/strings/strtok.c' <<'END_OF_FILE'
  1029. X/*
  1030. X * Get next token from string s (NULL on 2nd, 3rd, etc. calls),
  1031. X * where tokens are nonempty strings separated by runs of
  1032. X * chars from delim.  Writes NULs into s to end tokens.  delim need not
  1033. X * remain constant from call to call.
  1034. X */
  1035. X
  1036. X#define    NULL    0
  1037. X
  1038. Xstatic char *scanpoint = NULL;
  1039. X
  1040. Xchar *                /* NULL if no token left */
  1041. Xstrtok(s, delim)
  1042. Xchar *s;
  1043. Xregister CONST char *delim;
  1044. X{
  1045. X    register char *scan;
  1046. X    char *tok;
  1047. X    register CONST char *dscan;
  1048. X
  1049. X    if (s == NULL && scanpoint == NULL)
  1050. X        return(NULL);
  1051. X    if (s != NULL)
  1052. X        scan = s;
  1053. X    else
  1054. X        scan = scanpoint;
  1055. X
  1056. X    /*
  1057. X     * Scan leading delimiters.
  1058. X     */
  1059. X    for (; *scan != '\0'; scan++) {
  1060. X        for (dscan = delim; *dscan != '\0'; dscan++)
  1061. X            if (*scan == *dscan)
  1062. X                break;
  1063. X        if (*dscan == '\0')
  1064. X            break;
  1065. X    }
  1066. X    if (*scan == '\0') {
  1067. X        scanpoint = NULL;
  1068. X        return(NULL);
  1069. X    }
  1070. X
  1071. X    tok = scan;
  1072. X
  1073. X    /*
  1074. X     * Scan token.
  1075. X     */
  1076. X    for (; *scan != '\0'; scan++) {
  1077. X        for (dscan = delim; *dscan != '\0';)    /* ++ moved down. */
  1078. X            if (*scan == *dscan++) {
  1079. X                scanpoint = scan+1;
  1080. X                *scan = '\0';
  1081. X                return(tok);
  1082. X            }
  1083. X    }
  1084. X
  1085. X    /*
  1086. X     * Reached end of string.
  1087. X     */
  1088. X    scanpoint = NULL;
  1089. X    return(tok);
  1090. X}
  1091. END_OF_FILE
  1092. if test 1103 -ne `wc -c <'libc/strings/strtok.c'`; then
  1093.     echo shar: \"'libc/strings/strtok.c'\" unpacked with wrong size!
  1094. fi
  1095. # end of 'libc/strings/strtok.c'
  1096. fi
  1097. if test -f 'newsbin.proto/control/newgroup.2' -a "${1}" != "-c" ; then 
  1098.   echo shar: Will not clobber existing file \"'newsbin.proto/control/newgroup.2'\"
  1099. else
  1100. echo shar: Extracting \"'newsbin.proto/control/newgroup.2'\" \(771 characters\)
  1101. sed "s/^X//" >'newsbin.proto/control/newgroup.2' <<'END_OF_FILE'
  1102. X#! /bin/sh
  1103. X# newgroup group - create group (2-field version: pre-B-2.10.2 compatible)
  1104. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  1105. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  1106. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  1107. XPATH=/bin:/usr/bin:/usr/ucb:$NEWSCTL:$NEWSBIN; export PATH    # must find mkpdir
  1108. XF=/tmp/nc$$
  1109. Xadmin=usenet
  1110. X
  1111. Xcat >$F
  1112. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  1113. Xcase "$SENDER" in
  1114. X"")
  1115. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  1116. X    ;;
  1117. Xesac
  1118. X
  1119. Xif grep -s "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active; then    # group exists
  1120. X    : do nothing
  1121. Xelse                            # no group, make it
  1122. X    echo "$1 00000" >>$NEWSCTL/active
  1123. X    mkpdir $NEWSARTS/`echo $1 | sed 's/\./\//g' `
  1124. X    echo "newsgroup $1 was created by $SENDER." | mail $admin
  1125. Xfi
  1126. X
  1127. Xrm -f $F*
  1128. END_OF_FILE
  1129. if test 771 -ne `wc -c <'newsbin.proto/control/newgroup.2'`; then
  1130.     echo shar: \"'newsbin.proto/control/newgroup.2'\" unpacked with wrong size!
  1131. fi
  1132. # end of 'newsbin.proto/control/newgroup.2'
  1133. fi
  1134. if test -f 'newsbin.proto/control/newgroup.3' -a "${1}" != "-c" ; then 
  1135.   echo shar: Will not clobber existing file \"'newsbin.proto/control/newgroup.3'\"
  1136. else
  1137. echo shar: Extracting \"'newsbin.proto/control/newgroup.3'\" \(773 characters\)
  1138. sed "s/^X//" >'newsbin.proto/control/newgroup.3' <<'END_OF_FILE'
  1139. X#! /bin/sh
  1140. X# newgroup group - create group (3-field version: B-2.10.2 compatible)
  1141. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  1142. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  1143. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  1144. XPATH=/bin:/usr/bin:/usr/ucb:$NEWSCTL:$NEWSBIN; export PATH    # must find mkpdir
  1145. XF=/tmp/nc$$
  1146. Xadmin=usenet
  1147. X
  1148. Xcat >$F
  1149. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  1150. Xcase "$SENDER" in
  1151. X"")
  1152. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  1153. X    ;;
  1154. Xesac
  1155. X
  1156. Xif grep -s "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active; then    # group exists
  1157. X    : do nothing
  1158. Xelse                            # no group, make it
  1159. X    echo "$1 00000 00000" >>$NEWSCTL/active
  1160. X    mkpdir $NEWSARTS/`echo $1 | sed 's/\./\//g' `
  1161. X    echo "newsgroup $1 was created by $SENDER." | mail $admin
  1162. Xfi
  1163. X
  1164. Xrm -f $F*
  1165. END_OF_FILE
  1166. if test 773 -ne `wc -c <'newsbin.proto/control/newgroup.3'`; then
  1167.     echo shar: \"'newsbin.proto/control/newgroup.3'\" unpacked with wrong size!
  1168. fi
  1169. # end of 'newsbin.proto/control/newgroup.3'
  1170. fi
  1171. if test -f 'newsbin.proto/control/rmgroup.auto' -a "${1}" != "-c" ; then 
  1172.   echo shar: Will not clobber existing file \"'newsbin.proto/control/rmgroup.auto'\"
  1173. else
  1174. echo shar: Extracting \"'newsbin.proto/control/rmgroup.auto'\" \(995 characters\)
  1175. sed "s/^X//" >'newsbin.proto/control/rmgroup.auto' <<'END_OF_FILE'
  1176. X#! /bin/sh
  1177. X# rmgroup group - snuff group. active file is locked at entry
  1178. XNEWSCTL=${NEWSCTL-/usr/lib/news}; export NEWSCTL
  1179. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}; export NEWSBIN
  1180. XNEWSARTS=${NEWSARTS-/usr/spool/news}; export NEWSARTS
  1181. XF=/tmp/nc$$
  1182. Xadmin=usenet
  1183. X
  1184. Xcat >$F
  1185. X
  1186. XSENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
  1187. Xcase "$SENDER" in
  1188. X"")
  1189. X    SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
  1190. X    ;;
  1191. Xesac
  1192. X
  1193. X# remove active entry
  1194. Xsed "/^`echo $1 | sed 's/\./\\\\./g'` /d" $NEWSCTL/active >$F.act
  1195. Xcp $NEWSCTL/active $NEWSCTL/active.old
  1196. Xcp $F.act $NEWSCTL/active
  1197. X
  1198. X# rm -rf $NEWSARTS/`echo $1 | sed 's;\.;/;g'`    # remove the directory
  1199. Xdir=$NEWSARTS/`echo $1 | sed 's;\.;/;g'`    # name the directory
  1200. Xexport dir                # for sub-shell below
  1201. X(
  1202. X    cd /tmp                # in case "cd $dir" fails but shell continues
  1203. X    cd $dir                # go there
  1204. X    rm -f *
  1205. X    cd ..
  1206. X    rmdir `basename "$dir" '' `    # remove the empty directory
  1207. X)
  1208. X
  1209. X# tell the local usenet administrator the bad news
  1210. Xecho "rmgrouped $1 cuz $SENDER said to" | mail $admin
  1211. X
  1212. Xrm -f $F*
  1213. END_OF_FILE
  1214. if test 995 -ne `wc -c <'newsbin.proto/control/rmgroup.auto'`; then
  1215.     echo shar: \"'newsbin.proto/control/rmgroup.auto'\" unpacked with wrong size!
  1216. fi
  1217. # end of 'newsbin.proto/control/rmgroup.auto'
  1218. fi
  1219. if test -f 'rna/lib/bsearch.c' -a "${1}" != "-c" ; then 
  1220.   echo shar: Will not clobber existing file \"'rna/lib/bsearch.c'\"
  1221. else
  1222. echo shar: Extracting \"'rna/lib/bsearch.c'\" \(876 characters\)
  1223. sed "s/^X//" >'rna/lib/bsearch.c' <<'END_OF_FILE'
  1224. X/*LINTLIBRARY*/
  1225. X/*
  1226. X * Binary search algorithm, generalized from Knuth (6.2.1) Algorithm B.
  1227. X *
  1228. X * Written by J. S. Rugaber; rewritten by L. Rosler, Dept. 45175, August, 1981.
  1229. X */
  1230. X
  1231. Xtypedef char *POINTER;
  1232. X
  1233. XPOINTER
  1234. Xbsearch(key, base, nel, width, compar)
  1235. XPOINTER    key;            /* Key to be located */
  1236. XPOINTER    base;            /* Beginning of table */
  1237. Xunsigned nel;            /* Number of elements in the table */
  1238. Xunsigned width;            /* Width of an element (bytes) */
  1239. Xint    (*compar)();        /* Comparison function */
  1240. X{
  1241. X    int two_width = width + width;
  1242. X    POINTER last = base + width * (nel - 1); /* Last element in table */
  1243. X
  1244. X    while (last >= base) {
  1245. X
  1246. X        register POINTER p = base + width * ((last - base)/two_width);
  1247. X        register int res = (*compar)(key, p);
  1248. X
  1249. X        if (res == 0)
  1250. X            return (p);    /* Key found */
  1251. X        if (res < 0)
  1252. X            last = p - width;
  1253. X        else
  1254. X            base = p + width;
  1255. X    }
  1256. X    return ((POINTER) 0);        /* Key not found */
  1257. X}
  1258. END_OF_FILE
  1259. if test 876 -ne `wc -c <'rna/lib/bsearch.c'`; then
  1260.     echo shar: \"'rna/lib/bsearch.c'\" unpacked with wrong size!
  1261. fi
  1262. # end of 'rna/lib/bsearch.c'
  1263. fi
  1264. if test -f 'rna/news.help' -a "${1}" != "-c" ; then 
  1265.   echo shar: Will not clobber existing file \"'rna/news.help'\"
  1266. else
  1267. echo shar: Extracting \"'rna/news.help'\" \(880 characters\)
  1268. sed "s/^X//" >'rna/news.help' <<'END_OF_FILE'
  1269. XCommands to read news:
  1270. X
  1271. XRETURN        either print current article or go to next article and print header
  1272. X
  1273. X.        print current article    + or ;      go to next article
  1274. X-         go to previous article    s [file]  save current article
  1275. Xh        print current header    H      print current header in full
  1276. Xu        unsubscribe from followups    U      unsubscribe from current group
  1277. Xq or EOT    quit            x      exit (as if no articles seen)
  1278. X<number>    go to article <number>    !cmd      shell escape
  1279. Xn [newsgrp] go to next newsgroup    DEL      break to command level
  1280. X
  1281. XCommands to post/reply/cancel news:
  1282. X
  1283. Xc        cancel article         r      reply to sender (by mail)
  1284. Xf        post a followup article    p      post new article
  1285. Xm person    mail to person
  1286. X
  1287. XCommands when posting/replying (p, r, f and m commands):
  1288. X
  1289. X. or EOT    terminate article        .e      edit article
  1290. X.!cmd        shell escape        .i      interpolate current item
  1291. XDEL        abort posting/mailing
  1292. END_OF_FILE
  1293. if test 880 -ne `wc -c <'rna/news.help'`; then
  1294.     echo shar: \"'rna/news.help'\" unpacked with wrong size!
  1295. fi
  1296. # end of 'rna/news.help'
  1297. fi
  1298. if test -f 'rna/postgroup.sh' -a "${1}" != "-c" ; then 
  1299.   echo shar: Will not clobber existing file \"'rna/postgroup.sh'\"
  1300. else
  1301. echo shar: Extracting \"'rna/postgroup.sh'\" \(890 characters\)
  1302. sed "s/^X//" >'rna/postgroup.sh' <<'END_OF_FILE'
  1303. X# postgroups
  1304. X#    Michael Rourke July 84
  1305. XDCS= EE= STAFF= HON= PG=
  1306. Xfor G in `/etc/bin/mkclass -l`
  1307. Xdo
  1308. X    case $G in
  1309. X    DCS*|C-*)    DCS="$DCS $G";;
  1310. X    EE*)    EE="$EE $G";;
  1311. X    esac
  1312. X    case $G in
  1313. X    *Staff)    STAFF="$STAFF $G";;
  1314. X    *HON)    HON="$HON $G";;
  1315. X    *PG)    PG="$PG $G";;
  1316. X    esac
  1317. Xdone
  1318. XALL="$STAFF $HON $PG"
  1319. XBAD= LIST=
  1320. Xif [ $# -gt 0 ]
  1321. Xthen
  1322. X    case "$1" in
  1323. X    DCS|EE|STAFF|HON|PG|ALL) LIST="$LIST `eval echo '$'$1`";;
  1324. X    *) echo "Unknown group: $1"
  1325. X       BAD=1;;
  1326. X    esac
  1327. Xfi
  1328. Xif [ $# -eq 0 -o -n "$BAD" ]
  1329. Xthen
  1330. X    cat <<!
  1331. XUsage: postgroup group [ postnews_args ... ]
  1332. X    Groups are:
  1333. X    STAFF    (All staff:$STAFF)
  1334. X    DCS    (Dept of CS Staff, Hons & PG Students:
  1335. X            $DCS)
  1336. X    EE    (Elec Eng Staff, Hons & PG Students:$EE)
  1337. X    HON    (Honours Students:$HON)
  1338. X    PG    (Post Grad Students:$PG)
  1339. X    ALL    (All the above:
  1340. X            $ALL)
  1341. X!
  1342. X    exit 1
  1343. Xfi
  1344. XNL=
  1345. Xfor L in $LIST
  1346. Xdo
  1347. X    if [ ! "$NL" ]
  1348. X    then
  1349. X        NL="class.$L"
  1350. X    else
  1351. X        NL="$NL,class.$L"
  1352. X    fi
  1353. Xdone
  1354. Xexec /bin/postnews -n "$NL" $2*
  1355. END_OF_FILE
  1356. if test 890 -ne `wc -c <'rna/postgroup.sh'`; then
  1357.     echo shar: \"'rna/postgroup.sh'\" unpacked with wrong size!
  1358. fi
  1359. # end of 'rna/postgroup.sh'
  1360. fi
  1361. if test -f 'rna/uurec.c' -a "${1}" != "-c" ; then 
  1362.   echo shar: Will not clobber existing file \"'rna/uurec.c'\"
  1363. else
  1364. echo shar: Extracting \"'rna/uurec.c'\" \(1167 characters\)
  1365. sed "s/^X//" >'rna/uurec.c' <<'END_OF_FILE'
  1366. X/*
  1367. X * uurec - receive articles via /bin/mail.
  1368. X */
  1369. X
  1370. X#include "defs.h"
  1371. X
  1372. X#undef OTHER
  1373. X
  1374. X#define FROM    01
  1375. X#define NLIN    02
  1376. X#define BLANK    03
  1377. X#define OTHER    04
  1378. X
  1379. X#define SKIPPING    010
  1380. X#define READING        020
  1381. X
  1382. X#define BFSZ 250
  1383. X
  1384. Xmain()
  1385. X{
  1386. X    char buf[BFSZ];
  1387. X    register FILE     *pipe;
  1388. X    register int mode, frmflg;
  1389. X
  1390. X    pipe = stdout;
  1391. X    mode = SKIPPING;
  1392. X    frmflg = FALSE;
  1393. X    while (fgets(buf, BFSZ, stdin) != NULL)
  1394. X        switch (mode | type(buf)) {
  1395. X        case FROM | SKIPPING:
  1396. X            frmflg = TRUE;
  1397. X            break;
  1398. X
  1399. X        case FROM | READING:
  1400. X            if (!frmflg) {
  1401. X                frmflg = TRUE;
  1402. X                pclose(pipe);
  1403. X            }
  1404. X            break;
  1405. X
  1406. X        case NLIN | SKIPPING:
  1407. X            mode = READING;
  1408. X
  1409. X        case NLIN | READING:
  1410. X            if (frmflg) {
  1411. X                frmflg = FALSE;
  1412. X                if ((pipe = popen(RNEWS, "w")) == NULL) {
  1413. X                    perror("uurec: popen failed");
  1414. X                    exit(1);
  1415. X                }
  1416. X            }
  1417. X            fputs(buf + 1, pipe);
  1418. X            break;
  1419. X
  1420. X        case OTHER | SKIPPING:
  1421. X            break;
  1422. X
  1423. X        case OTHER | READING:
  1424. X            pclose(pipe);
  1425. X            mode = SKIPPING;
  1426. X        }
  1427. X    if (pipe)
  1428. X        pclose(pipe);
  1429. X    exit(0);
  1430. X}
  1431. X
  1432. X
  1433. Xtype(p)
  1434. Xregister char *p;
  1435. X{
  1436. X    while (*p == ' ' || *p == '?')
  1437. X        ++p;
  1438. X
  1439. X    if (*p == 'N')
  1440. X        return (NLIN);
  1441. X
  1442. X    if (CMPN(p, ">From", 5) == 0)
  1443. X        return (FROM);
  1444. X
  1445. X    if (CMPN(p, "From", 4) == 0)
  1446. X        return (FROM);
  1447. X
  1448. X    return(OTHER);
  1449. X}
  1450. X
  1451. X
  1452. END_OF_FILE
  1453. if test 1167 -ne `wc -c <'rna/uurec.c'`; then
  1454.     echo shar: \"'rna/uurec.c'\" unpacked with wrong size!
  1455. fi
  1456. # end of 'rna/uurec.c'
  1457. fi
  1458. if test -f 'rnews/ads/1' -a "${1}" != "-c" ; then 
  1459.   echo shar: Will not clobber existing file \"'rnews/ads/1'\"
  1460. else
  1461. echo shar: Extracting \"'rnews/ads/1'\" \(1114 characters\)
  1462. sed "s/^X//" >'rnews/ads/1' <<'END_OF_FILE'
  1463. XINEWS. We have
  1464. Xthe technology
  1465. Xtoday to bring 'em
  1466. Xback tomorrow.
  1467. X
  1468. X    By the 1990s, fighter pilots will need an inte-
  1469. Xgrated electronic warfare suite that fuses the
  1470. Xcapabilities of multiple warning and response sys-
  1471. Xtems. Advanced technology that provides complete
  1472. Xprotection with greater reliability. That system is the
  1473. XIntegrated Electronic Warfare System - INEWS.
  1474. X    The TRW/Westinghouse Joint Venture is the
  1475. Xonly team that offers such a powerful combination
  1476. Xof advanced technologies and specific, long-term
  1477. Xexperience for INEWS.
  1478. X    Our Phase I and II VHSIC contracts, together
  1479. Xwith our VHSIC 1750A program, will increase pro-
  1480. Xcessing speed and memory and reduce space and
  1481. Xpower demands. Our wideband microwave trans-
  1482. Xmitters and receivers can make functional integra-
  1483. Xtion a cost-effective, operational reality. Our detector
  1484. Xtechnologies ensure instant warning of all fore-
  1485. Xseeable threats. And our expendables technology
  1486. Xprovides a wide range of threat-response options.
  1487. X    TRW and Westinghouse with
  1488. XHoneywell, Perkin-Elmer, and Tracor.
  1489. XThe team with the technology today
  1490. Xto bring 'em back tomorrow.
  1491. X
  1492. X  TRW
  1493. END_OF_FILE
  1494. if test 1114 -ne `wc -c <'rnews/ads/1'`; then
  1495.     echo shar: \"'rnews/ads/1'\" unpacked with wrong size!
  1496. fi
  1497. # end of 'rnews/ads/1'
  1498. fi
  1499. if test -f 'rnews/ads/2' -a "${1}" != "-c" ; then 
  1500.   echo shar: Will not clobber existing file \"'rnews/ads/2'\"
  1501. else
  1502. echo shar: Extracting \"'rnews/ads/2'\" \(979 characters\)
  1503. sed "s/^X//" >'rnews/ads/2' <<'END_OF_FILE'
  1504. XINEWS. Technology on a totally different plane.
  1505. X
  1506. X    The Raytheon-Northrop joint
  1507. Xventure team brings state-of-the-art
  1508. Xtechnology to the competition for
  1509. Xthe Integrated Electronic Warfare
  1510. XSystem. INEWS will go aboard the
  1511. Xnext generation of tactical aircraft.
  1512. X    The combination of Raytheon
  1513. Xand Northrop unites their comple-
  1514. Xmentary capabilities in the design,
  1515. Xdevelopment and production of
  1516. Xinnovative EW systems.
  1517. X    Team members AT&T Tech-
  1518. Xnology Systems (Bell Labs), GTE,
  1519. XMagnavox and Tracor provide
  1520. Xadditional experience which is
  1521. Xkey to successful integration of
  1522. Xadvanced technologies.
  1523. X    No other EW team provides
  1524. Xthis same level of expertise in
  1525. Xradar systems, surface-to-air mis-
  1526. Xsiles and advanced tactical and
  1527. Xstrategic aircraft. Strengths that
  1528. Xare essential to INEWS develop-
  1529. Xment and support.
  1530. X    The Raytheon and Northrop
  1531. Xjoint venture team. Expertise on a
  1532. Xtotally different plane.
  1533. X
  1534. XRaytheon NORTHROP
  1535. XJoint venture program office
  1536. X6380 Hollister Avenue
  1537. XGoleta, CA 93117
  1538. END_OF_FILE
  1539. if test 979 -ne `wc -c <'rnews/ads/2'`; then
  1540.     echo shar: \"'rnews/ads/2'\" unpacked with wrong size!
  1541. fi
  1542. # end of 'rnews/ads/2'
  1543. fi
  1544. if test -f 'rnews/ads/3' -a "${1}" != "-c" ; then 
  1545.   echo shar: Will not clobber existing file \"'rnews/ads/3'\"
  1546. else
  1547. echo shar: Extracting \"'rnews/ads/3'\" \(1027 characters\)
  1548. sed "s/^X//" >'rnews/ads/3' <<'END_OF_FILE'
  1549. XINEWS.
  1550. XTheir future
  1551. Xdepends on it.
  1552. X
  1553. XIn the 1990's and beyond, our pilots' survival and
  1554. Xtheir mission success will rely on an effective
  1555. XIntegrated Electronic Warfare Systems (INEWS).
  1556. XGuaranteeing the best INEWS for tomorrow
  1557. Xmeans selecting the right team to build it today.
  1558. X     With Honeywell, Perkin-Elmer, and Tracor,
  1559. Xthe TRW/Westinghouse team brings an un-
  1560. Xrivaled program and technology baseline to
  1561. XINEWS. Together we are concentrating on
  1562. Xsystem level development...providing risk
  1563. Xreduction where it counts: system software
  1564. Xand system integration.
  1565. X     Our team offers Ada on VHSIC, complete
  1566. XINEWS system simulation, expert system devel-
  1567. Xopment for full situation awareness and response
  1568. Xmanagement, and reliability and maintainability
  1569. Xrisk reduction to reduce operation and support
  1570. Xcosts while increasing system availability. The
  1571. XTRW/Westinghouse INEWS--reliable perform-
  1572. Xance to beat the threat, sustainable in conflict,
  1573. Xaffordable for a lifetime.
  1574. X    INEWS: The System for Their Future--
  1575. Xfrom TRW and Westinghouse.
  1576. X
  1577. X    TRW
  1578. END_OF_FILE
  1579. if test 1027 -ne `wc -c <'rnews/ads/3'`; then
  1580.     echo shar: \"'rnews/ads/3'\" unpacked with wrong size!
  1581. fi
  1582. # end of 'rnews/ads/3'
  1583. fi
  1584. if test -f 'rnews/anews/b.to.a' -a "${1}" != "-c" ; then 
  1585.   echo shar: Will not clobber existing file \"'rnews/anews/b.to.a'\"
  1586. else
  1587. echo shar: Extracting \"'rnews/anews/b.to.a'\" \(798 characters\)
  1588. sed "s/^X//" >'rnews/anews/b.to.a' <<'END_OF_FILE'
  1589. X#! /bin/sh
  1590. X# bnewstoa: B-format news to A-format converter (why, oh, why?) (thanks, Norman)
  1591. XPATH=/bin:/usr/bin:/usr/ucb; export PATH
  1592. X
  1593. Xawk '
  1594. XNR==1,/^$/    {        # headers: save A headers only
  1595. X    if ($0 ~ /^Message-ID: /)
  1596. X        msgid=$2
  1597. X    else if ($0 ~ /^Newsgroups: /)
  1598. X        ngs=$2
  1599. X    else if ($0 ~ /^Path: /)
  1600. X        path=$2
  1601. X    else if ($0 ~ /^Date: /) {
  1602. X        date = $2    # skip "Date:"
  1603. X        for (i = 3; i <= NF; i++)
  1604. X            date = date " " $i    # append remaining fields
  1605. X    } else if ($0 ~ /^Subject: /)
  1606. X        subj=$2
  1607. X    else if ($0 ~ /^$/) {    # end of headers: spew out A-format equivalent
  1608. X        print "A" msgid
  1609. X        print ngs
  1610. X        print path
  1611. X        print date
  1612. X        print subj
  1613. X        inbody = "yes"
  1614. X        noblanksyet = "yes"
  1615. X    }
  1616. X}
  1617. Xinbody=="yes"    {    # copy body except first blank line, if present
  1618. X    if ($0 ~ /^$/ && noblanksyet == "yes")
  1619. X        noblanksyet = "no"
  1620. X    else
  1621. X        print
  1622. X}
  1623. X'
  1624. END_OF_FILE
  1625. if test 798 -ne `wc -c <'rnews/anews/b.to.a'`; then
  1626.     echo shar: \"'rnews/anews/b.to.a'\" unpacked with wrong size!
  1627. fi
  1628. # end of 'rnews/anews/b.to.a'
  1629. fi
  1630. if test -f 'rnews/hostname.c' -a "${1}" != "-c" ; then 
  1631.   echo shar: Will not clobber existing file \"'rnews/hostname.c'\"
  1632. else
  1633. echo shar: Extracting \"'rnews/hostname.c'\" \(881 characters\)
  1634. sed "s/^X//" >'rnews/hostname.c' <<'END_OF_FILE'
  1635. X/*
  1636. X * hostname - return the Usenet name of this machine
  1637. X *
  1638. X * One interesting possibility would be to assume that the first
  1639. X * name in the sys file is our Usenet name, unless it is "ME",
  1640. X * which would require our current strategy anyway.
  1641. X */
  1642. X
  1643. X#include <stdio.h>
  1644. X#include <sys/types.h>
  1645. X
  1646. X#include "news.h"
  1647. X#include "newspaths.h"
  1648. X
  1649. X#ifndef NAMEFILE
  1650. X#define NAMEFILE libfile("whoami")
  1651. X#endif
  1652. X
  1653. Xchar *
  1654. Xhostname()            /* return this Usenet machine's name */
  1655. X{
  1656. X    static char name[MAXHOST];
  1657. X
  1658. X    if (name[0] == '\0') {    /* try to get the "news hostname" */
  1659. X        FILE *fp;
  1660. X
  1661. X        fp = fopen(NAMEFILE, "r");
  1662. X        if (fp != NULL) {
  1663. X            (void) fgets(name, sizeof name, fp);
  1664. X            (void) fclose(fp);
  1665. X            if (name[0] != '\0' && name[strlen(name) - 1] == '\n')
  1666. X                name[strlen(name) - 1] = '\0';
  1667. X        }
  1668. X    }
  1669. X    if (name[0] == '\0')    /* else use the ordinary hostname */
  1670. X        (void) gethostname(name, sizeof name);
  1671. X    return name;
  1672. X}
  1673. END_OF_FILE
  1674. if test 881 -ne `wc -c <'rnews/hostname.c'`; then
  1675.     echo shar: \"'rnews/hostname.c'\" unpacked with wrong size!
  1676. fi
  1677. # end of 'rnews/hostname.c'
  1678. fi
  1679. if test -f 'rnews/man/inews.1' -a "${1}" != "-c" ; then 
  1680.   echo shar: Will not clobber existing file \"'rnews/man/inews.1'\"
  1681. else
  1682. echo shar: Extracting \"'rnews/man/inews.1'\" \(1160 characters\)
  1683. sed "s/^X//" >'rnews/man/inews.1' <<'END_OF_FILE'
  1684. X.TH INEWS 1 Usenet "Public Domain"
  1685. X.DA 22 Aug 1987
  1686. X.SH NAME
  1687. Xinews \- `user-friendly' front-end for rnews
  1688. X.SH SYNOPSIS
  1689. X.B inews
  1690. X[
  1691. X.B \-h
  1692. X]
  1693. X.\" TODO: fill in silly B options here
  1694. X[
  1695. Xfile ...
  1696. X]
  1697. X.SH DESCRIPTION
  1698. X.I Inews
  1699. Xbroadcasts a (network) news article
  1700. X(\fIi\fPnjects it into the
  1701. X.I news
  1702. Xflow)
  1703. Xnormally
  1704. Xby giving it as standard input to
  1705. X.IR rnews (1),
  1706. Xafter adding and altering headers.
  1707. XThe article will instead be mailed
  1708. Xto the moderators of the moderated newsgroups in the
  1709. X.I Newsgroups:
  1710. Xheader,
  1711. Xif any are found.
  1712. XNormal usage is simply
  1713. X.IR "inews -h" .
  1714. X.PP
  1715. XThere are plenty of silly options
  1716. X(inherited from B news)
  1717. Xwhich are essentially all equivalent to
  1718. Xadding headers.
  1719. X.SH FILES
  1720. X.PD 0
  1721. X.TP 1.5i
  1722. X.IB $NEWSCTL /active
  1723. Xcontains (un)moderated flag
  1724. X.PD
  1725. X.SH "SEE ALSO"
  1726. X.IR mail (1),
  1727. X.IR rnews (1)
  1728. X.\" .SH DIAGNOSTICS
  1729. X.\" This section appears ONLY if there is something unobvious and important about
  1730. X.\" the diagnostics or the general behavior in case of error.
  1731. X.SH HISTORY
  1732. XWritten by Geoff Collyer
  1733. Xat the University of Toronto
  1734. Xas part of the C news project.
  1735. X.SH BUGS
  1736. X.I Inews
  1737. Xshould be unnecessary;
  1738. Xmost long-time news posters simply use
  1739. X.I rnews
  1740. Xdirectly anyway.
  1741. END_OF_FILE
  1742. if test 1160 -ne `wc -c <'rnews/man/inews.1'`; then
  1743.     echo shar: \"'rnews/man/inews.1'\" unpacked with wrong size!
  1744. fi
  1745. # end of 'rnews/man/inews.1'
  1746. fi
  1747. if test -f 'rnews/serverrnews' -a "${1}" != "-c" ; then 
  1748.   echo shar: Will not clobber existing file \"'rnews/serverrnews'\"
  1749. else
  1750. echo shar: Extracting \"'rnews/serverrnews'\" \(906 characters\)
  1751. sed "s/^X//" >'rnews/serverrnews' <<'END_OF_FILE'
  1752. X#! /bin/sh
  1753. X# execute relaynews commands on the server, for the sake of locking
  1754. XNEWSCTL=${NEWSCTL-/usr/lib/news}    # export NEWSCTL
  1755. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}    # export NEWSBIN
  1756. XNEWSARTS=${NEWSARTS-/usr/spool/news}    # export NEWSARTS
  1757. XPATH=$NEWSCTL:$NEWSBIN:$NEWSBIN/relay:/bin:/usr/bin:/usr/ucb:/usr/local; export PATH
  1758. X
  1759. X# set -x
  1760. Xserver=`cat $NEWSCTL/server 2>/dev/null`
  1761. Xcase "$server" in
  1762. X"")    server="`hostname`" ;;        # if no server file, assume this is it
  1763. Xesac
  1764. Xcase "`hostname`" in
  1765. X$server)
  1766. X    case $# in
  1767. X    0)    exec relaynews ;;        # do it locally
  1768. X    *)    exec relaynews "$@" ;;        # do it locally
  1769. X    esac
  1770. X    ;;
  1771. X*)                # kick it to the server
  1772. X    here="`pwd`"
  1773. X    case "$here" in
  1774. X    /n/*)    ;;        # already anchored
  1775. X    *)            # needs to be qualified
  1776. X        HOST="`hostname`"
  1777. X        here=/n/$HOST/$here    # V8-style remote machine name
  1778. X        ;;
  1779. X    esac
  1780. X    cmd=""
  1781. X    for arg
  1782. X    do
  1783. X        cmd="$cmd "\'$arg\'
  1784. X    done
  1785. X    exec rsh $server "cd $here; relaynews $cmd"
  1786. X    ;;
  1787. Xesac
  1788. END_OF_FILE
  1789. if test 906 -ne `wc -c <'rnews/serverrnews'`; then
  1790.     echo shar: \"'rnews/serverrnews'\" unpacked with wrong size!
  1791. fi
  1792. # end of 'rnews/serverrnews'
  1793. fi
  1794. if test -f 'rnews/sh/serverrnews' -a "${1}" != "-c" ; then 
  1795.   echo shar: Will not clobber existing file \"'rnews/sh/serverrnews'\"
  1796. else
  1797. echo shar: Extracting \"'rnews/sh/serverrnews'\" \(906 characters\)
  1798. sed "s/^X//" >'rnews/sh/serverrnews' <<'END_OF_FILE'
  1799. X#! /bin/sh
  1800. X# execute relaynews commands on the server, for the sake of locking
  1801. XNEWSCTL=${NEWSCTL-/usr/lib/news}    # export NEWSCTL
  1802. XNEWSBIN=${NEWSBIN-/usr/lib/newsbin}    # export NEWSBIN
  1803. XNEWSARTS=${NEWSARTS-/usr/spool/news}    # export NEWSARTS
  1804. XPATH=$NEWSCTL:$NEWSBIN:$NEWSBIN/relay:/bin:/usr/bin:/usr/ucb:/usr/local; export PATH
  1805. X
  1806. X# set -x
  1807. Xserver=`cat $NEWSCTL/server 2>/dev/null`
  1808. Xcase "$server" in
  1809. X"")    server="`hostname`" ;;        # if no server file, assume this is it
  1810. Xesac
  1811. Xcase "`hostname`" in
  1812. X$server)
  1813. X    case $# in
  1814. X    0)    exec relaynews ;;        # do it locally
  1815. X    *)    exec relaynews "$@" ;;        # do it locally
  1816. X    esac
  1817. X    ;;
  1818. X*)                # kick it to the server
  1819. X    here="`pwd`"
  1820. X    case "$here" in
  1821. X    /n/*)    ;;        # already anchored
  1822. X    *)            # needs to be qualified
  1823. X        HOST="`hostname`"
  1824. X        here=/n/$HOST/$here    # V8-style remote machine name
  1825. X        ;;
  1826. X    esac
  1827. X    cmd=""
  1828. X    for arg
  1829. X    do
  1830. X        cmd="$cmd "\'$arg\'
  1831. X    done
  1832. X    exec rsh $server "cd $here; relaynews $cmd"
  1833. X    ;;
  1834. Xesac
  1835. END_OF_FILE
  1836. if test 906 -ne `wc -c <'rnews/sh/serverrnews'`; then
  1837.     echo shar: \"'rnews/sh/serverrnews'\" unpacked with wrong size!
  1838. fi
  1839. # end of 'rnews/sh/serverrnews'
  1840. fi
  1841. if test -f 'rnews/string.c' -a "${1}" != "-c" ; then 
  1842.   echo shar: Will not clobber existing file \"'rnews/string.c'\"
  1843. else
  1844. echo shar: Extracting \"'rnews/string.c'\" \(1092 characters\)
  1845. sed "s/^X//" >'rnews/string.c' <<'END_OF_FILE'
  1846. X/*
  1847. X * string operations
  1848. X */
  1849. X
  1850. X#include <stdio.h>
  1851. X#include <sys/types.h>
  1852. X#include "news.h"
  1853. X
  1854. X/*
  1855. X * Copy tokens to firstone, remove all text starting at the first space.
  1856. X */
  1857. Xfirst(tokens, firstone)
  1858. Xregister char *tokens, *firstone;
  1859. X{
  1860. X    char *space;
  1861. X
  1862. X    (void) strcpy(firstone, tokens);
  1863. X    space = index(firstone, ' ');
  1864. X    if (space != NULL)
  1865. X        *space = '\0';        /* terminate firstone at first space */
  1866. X}
  1867. X
  1868. X/*
  1869. X * Turn a newsgroup name into a file name, in place.
  1870. X */
  1871. Xmkfilenm(ng)
  1872. Xregister char *ng;
  1873. X{
  1874. X    for (; *ng != '\0'; ng++)
  1875. X        if (*ng == NGDELIM)
  1876. X            *ng = FNDELIM;
  1877. X}
  1878. X
  1879. Xtrim(s)                    /* trim trailing newline */
  1880. Xchar *s;
  1881. X{
  1882. X    register char *nl;
  1883. X
  1884. X    INDEX(s, '\n', nl);
  1885. X    if (nl != NULL)
  1886. X        *nl = '\0';
  1887. X}
  1888. X
  1889. Xchar *
  1890. Xskipsp(s)                /* skip any whitespace at *s */
  1891. Xregister char *s;
  1892. X{
  1893. X    while (iswhite(*s))
  1894. X        s++;
  1895. X    return s;
  1896. X}
  1897. X
  1898. X/* like strdup, but error if can't allocate */
  1899. Xchar *
  1900. Xstrsave(s)            /* copy s into malloced memory, if any */
  1901. Xchar *s;
  1902. X{
  1903. X    register char *news = malloc((unsigned)strlen(s) + 1);    /* include NUL */
  1904. X
  1905. X    if (news != NULL)
  1906. X        (void) strcpy(news, s);
  1907. X    else
  1908. X        errunlock("out of memory", "");
  1909. X    return news;
  1910. X}
  1911. END_OF_FILE
  1912. if test 1092 -ne `wc -c <'rnews/string.c'`; then
  1913.     echo shar: \"'rnews/string.c'\" unpacked with wrong size!
  1914. fi
  1915. # end of 'rnews/string.c'
  1916. fi
  1917. if test -f 'rnews/system.h' -a "${1}" != "-c" ; then 
  1918.   echo shar: Will not clobber existing file \"'rnews/system.h'\"
  1919. else
  1920. echo shar: Extracting \"'rnews/system.h'\" \(1036 characters\)
  1921. sed "s/^X//" >'rnews/system.h' <<'END_OF_FILE'
  1922. X/*
  1923. X * parsed form of the SYSFILE
  1924. X */
  1925. Xstruct system {
  1926. X    char *sy_name;        /* machine name */
  1927. X    char *sy_excl;        /* exclusion list of machines */
  1928. X    char *sy_ngs;        /* newsgroup subscription list */
  1929. X    char *sy_distr;        /* distribution list */
  1930. X    char *sy_cmd;        /* command to transmit articles */
  1931. X    unsigned sy_lochops;    /* flags Ln value: local hops */
  1932. X    char sy_flags;        /* ornaments, encoded as bits */
  1933. X    struct system *sy_next;    /* link to next system */
  1934. X};
  1935. X
  1936. X/* sy_flags bits */
  1937. X#define FLG_IHAVEOLD    (1<<0)        /* N: broken I-have/send-me proto */
  1938. X/* #define FLG_PERM    (1<<1)        /* U: %s is a permanent file name */
  1939. X#define FLG_BATCH    (1<<2)        /* F: sy_cmd is batch filename */
  1940. X#define FLG_LOCAL    (1<<3)        /* L: send local articles only */
  1941. X#define FLG_IHAVE    (1<<4)        /* I: new I-have/send-me proto */
  1942. X#define FLG_MOD        (1<<5)        /* m: send moderated groups only */
  1943. X#define FLG_UNMOD    (1<<6)        /* u: send unmoderated groups only */
  1944. X#define FLG_SZBATCH    (1<<7)        /* f: like F, but include byte count */
  1945. X/* imports from system */
  1946. Xextern struct system *oursys(), *nextsys();
  1947. END_OF_FILE
  1948. if test 1036 -ne `wc -c <'rnews/system.h'`; then
  1949.     echo shar: \"'rnews/system.h'\" unpacked with wrong size!
  1950. fi
  1951. # end of 'rnews/system.h'
  1952. fi
  1953. if test -f 'rnews/test/demo/arts/art2' -a "${1}" != "-c" ; then 
  1954.   echo shar: Will not clobber existing file \"'rnews/test/demo/arts/art2'\"
  1955. else
  1956. echo shar: Extracting \"'rnews/test/demo/arts/art2'\" \(1025 characters\)
  1957. sed "s/^X//" >'rnews/test/demo/arts/art2' <<'END_OF_FILE'
  1958. XNewsgroups: net.drugs,net.emacs
  1959. XSubject: Re: Re: RE: re: rE: Re: Re: Orpha - (nf)
  1960. XMessage-ID: <willy.geoff@barek>
  1961. XHideous-Name: UCBVAX.@MIT-MC.@udel-relay.ARPA.chris.umcp-cs@UDEL-Relay
  1962. XDate-Received: yesterday
  1963. XRelay-Version: version A+; site rosen.rich
  1964. XPath: research!ihnp4!ihnp3!ihnp1!packard!topaz!cbosgd!drugvax!root
  1965. X
  1966. X> daemon:*:1:daemon,uucp
  1967. X> sys:*:2:bin,sys
  1968. X> bin70:*:3:
  1969. X> uucp70:*:4:
  1970. X> general:*:5:adams,al
  1971. X
  1972. XYou're all a bunch of fascists!
  1973. X-- 
  1974. XFish Face, Morons Incorporated
  1975. X<insert life story here>
  1976. XUUCP: ucbvax!mit-mc%udel-relay.arpa@ff:umcp-cs::udel-relay
  1977. XARPA: @brl.arpa:ucbvax!mit-mc%udel-relay.arpa@ff:umcp-cs::udel-relay
  1978. XCSnet: @brl.arpa:ucbvax!mit-mc%udel-relay.arpa@ff:umcp-cs::udel-relay%csnet-relay
  1979. XDEC E-net: rhea::@brl.arpa:ucbvax!mit-mc%udel-relay.arpa@ff:umcp-cs::udel-relay%csnet-relay
  1980. XCDNnet: rhea::@brl.arpa:ucbvax!mit-mc%udel-relay.arpa@ff:umcp-cs::udel-relay%csnet-relay.vision.ubc.cdn
  1981. XBITnet: psuvax1!rhea::@brl.arpa:ucbvax!mit-mc%udel-relay.arpa@ff:umcp-cs::udel-relay%csnet-relay.vision.ubc.cdn
  1982. END_OF_FILE
  1983. if test 1025 -ne `wc -c <'rnews/test/demo/arts/art2'`; then
  1984.     echo shar: \"'rnews/test/demo/arts/art2'\" unpacked with wrong size!
  1985. fi
  1986. # end of 'rnews/test/demo/arts/art2'
  1987. fi
  1988. if test -f 'rnews/test/demo/arts/art3' -a "${1}" != "-c" ; then 
  1989.   echo shar: Will not clobber existing file \"'rnews/test/demo/arts/art3'\"
  1990. else
  1991. echo shar: Extracting \"'rnews/test/demo/arts/art3'\" \(993 characters\)
  1992. sed "s/^X//" >'rnews/test/demo/arts/art3' <<'END_OF_FILE'
  1993. XNewsgroups: net.general,comp.unix.lizards,comp.unix.bozos
  1994. XPath: vt100aa!uw-muskrat!lbl-clams!MAILER-DAEMON
  1995. XDate: 4 May 83 00:16:37 VDT (Wed)
  1996. XFrom: lbl-clams!MAILER-DAEMON (Mail Delivery Subsystem)
  1997. XTo: uw-muskrat!vt100aa!yzuxab!nail
  1998. XRelayed-by: somsite.UUCP
  1999. XPast-on-by: another.CCCP
  2000. XMunged-up-by: erewhon.UUCP
  2001. XPosting-version: 2.9E3
  2002. XSubject: Returned mail: Who knows why?
  2003. XMessage-Id: <8305040716.AA21547@LBL-CLAMS.BARFA>
  2004. XReceived: by LBL-CLAMS.BARFA (3.320/3.21)
  2005. X    id AA21547; 4 May 83 00:16:37 VDT (Wed)
  2006. X
  2007. X   ----- Transcript of session follows -----
  2008. Xsparrow@gatech.barfa... Connecting to gatech.tcp...
  2009. Xsparrow@gatech.barfa... Like, who knows, man?
  2010. X
  2011. X   ----- Unsent message follows -----
  2012. XDate: 4 May 83 00:16:37 VDT (Wed)
  2013. XFrom: vt100aa!yzuxab!nail@uw-muskrat.UUCP
  2014. XMessage-Id: <8305040716.AA21545@LBL-CLAMS.BARFA>
  2015. XReceived: by LBL-CLAMS.BARFA (3.320/3.21)
  2016. X    id AA21545; 4 May 83 00:16:37 VDT (Wed)
  2017. XTo: vt100aa!uw-muskrat!lbl-clams!sparrow@gatech.barfa
  2018. X
  2019. XPlease take my name off your mailing list.
  2020. X
  2021. END_OF_FILE
  2022. if test 993 -ne `wc -c <'rnews/test/demo/arts/art3'`; then
  2023.     echo shar: \"'rnews/test/demo/arts/art3'\" unpacked with wrong size!
  2024. fi
  2025. # end of 'rnews/test/demo/arts/art3'
  2026. fi
  2027. if test -f 'time/ctime.c' -a "${1}" != "-c" ; then 
  2028.   echo shar: Will not clobber existing file \"'time/ctime.c'\"
  2029. else
  2030. echo shar: Extracting \"'time/ctime.c'\" \(1181 characters\)
  2031. sed "s/^X//" >'time/ctime.c' <<'END_OF_FILE'
  2032. X/*
  2033. X * ctime time_t ... - print the ascii time of time_t(s)
  2034. X */
  2035. X
  2036. X#include <stdio.h>
  2037. X#include <ctype.h>
  2038. X#include <time.h>
  2039. X#include <sys/types.h>
  2040. X#include <sys/timeb.h>
  2041. X
  2042. X#define    DAY    (24L*60L*60L)
  2043. X
  2044. Xstruct timeb ftnow;
  2045. X
  2046. Xchar *progname;
  2047. X
  2048. Xextern int errno;
  2049. Xextern char *strcpy();
  2050. Xextern char *strncpy();
  2051. Xextern char *strcat();
  2052. Xextern char *strchr();
  2053. Xextern char *strtok();
  2054. Xextern long atol();
  2055. Xextern char *malloc();
  2056. Xextern struct tm *gmtime();
  2057. Xextern time_t time();
  2058. X
  2059. X/* Forwards. */
  2060. Xextern void process();
  2061. X
  2062. X/*
  2063. X - main - parse arguments and handle options
  2064. X */
  2065. Xmain(argc, argv)
  2066. Xint argc;
  2067. Xchar *argv[];
  2068. X{
  2069. X    register int c;
  2070. X    register int errflg = 0;
  2071. X    extern int optind;
  2072. X    extern char *optarg;
  2073. X
  2074. X    progname = argv[0];
  2075. X    ftime(&ftnow);
  2076. X
  2077. X    while ((c = getopt(argc, argv, "")) != EOF)
  2078. X        switch (c) {
  2079. X        case '?':
  2080. X        default:
  2081. X            errflg++;
  2082. X            break;
  2083. X        }
  2084. X    if (errflg || optind == argc) {
  2085. X        (void) fprintf(stderr, "Usage: %s ascii_time ...\n", progname);
  2086. X        exit(2);
  2087. X    }
  2088. X
  2089. X    for (; optind < argc; optind++)
  2090. X        process(argv[optind]);
  2091. X    exit(0);
  2092. X}
  2093. X
  2094. X/*
  2095. X * process - print time_t of tm
  2096. X */
  2097. Xvoid
  2098. Xprocess(tms)
  2099. Xchar *tms;
  2100. X{
  2101. X    time_t tm;
  2102. X    char *ctime();
  2103. X    long atol();
  2104. X
  2105. X    tm = atol(tms);
  2106. X    (void) fputs(ctime(&tm), stdout);
  2107. X}
  2108. END_OF_FILE
  2109. if test 1181 -ne `wc -c <'time/ctime.c'`; then
  2110.     echo shar: \"'time/ctime.c'\" unpacked with wrong size!
  2111. fi
  2112. # end of 'time/ctime.c'
  2113. fi
  2114. echo shar: End of archive 3 \(of 14\).
  2115. ##  End of shell archive.
  2116. exit 0
  2117.